home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- Scan handler looking for BASIC subroutines (SUB or PROCEDURE).
-
- Scan handlers are plain functions (loadSeg()'ed): no standard C startup
- code and no library calls permitted. We have to put string constants into
- the code segment (DICE compiler: option -ms1).
-
- DICE:
-
- dcc basic.c -// -l0 -md -mRR -o golded:etc/scanner/basic
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- ULONG
- ScanHandlerBasic(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- const char *version = "$VER: Basic 1.0 (" __COMMODORE_DATE__ ")";
-
- if (len > 4) {
-
- if (**text == 'S') {
-
- if (((*text)[1] == 'U') && ((*text)[2] == 'B') && ((*text)[3] == ' ')) {
-
- // found SUB subroutine
-
- *text += 4;
-
- return(len - 4);
- }
- }
- else {
-
- if (**text == '>') {
-
- *text += 2;
- len -= 2;
- }
-
- if ((len > 10) && (**text == 'P')) {
-
- if (((*text)[1] == 'R') && ((*text)[2] == 'O') && ((*text)[3] == 'C') && ((*text)[4] == 'E') && ((*text)[5] == 'D') && ((*text)[6] == 'U') && ((*text)[7] == 'R') && ((*text)[8] == 'E') && ((*text)[9] == ' ')) {
-
- // found PROCEDURE
-
- *text += 10;
-
- return(len - 10);
- }
- }
- }
- }
-
- return(FALSE);
- }
-
-